
import 'package:package_info_plus/package_info_plus.dart';

class UtilPackage {
  /**
   * 获取版本信息
   */
  static Future<String> getVersion() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();

    String appName = packageInfo.appName;
    String packageName = packageInfo.packageName;
    String version = packageInfo.version;
    String buildNumber = packageInfo.buildNumber;

    print('appName: $appName');
    print('packageName: $packageName');
    print('version: $version');
    print('buildNumber: $buildNumber');

    return version;
  }
}